package com.xuhuan.demo.aspect;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author huan.xu
 * @Date 2023/5/4 14:59
 * @Description 被增强的类
 */
@RestController
@RequestMapping("/aspect")
public class TargetController {

  /**
   * 测试切面后置增强
   */
  @GetMapping("/test-after")
  public Object testAfterPoint() {
    List<Map> list = new ArrayList<>();
    for (int i = 0; i < 10; i++) {
      Map map = new HashMap(3);
      map.put("id", i);
      map.put("name", "name" + i);
      list.add(map);
    }
    return list;
  }
}
